#ifndef _UTHREADS_H
#define _UTHREADS_H

/*
 *       User-Level Threads Library (uthreads)
 *       Author: OS, os@cs.huji.ac.il
 */


#define STACK_SIZE 10000   /* stack size per thread (in bytes) */

/* external interface */

/* Initialize thread library */
int thread_lib_init();

/* Create a new thread whose entry point is f */
int thread_spawn(void (*thread_func)(void));

/* Terminate a thread */
int thread_terminate(int tid); 

/* Synchronize threads */
int thread_sync(int sync_id, int num);

/* Sleep */
int thread_sleep(int tid, int num_millisecs);

/* Get thread id */
int thread_gettid();

/* Get total quantums */
int thread_get_time_until_wakeup(int tid);

/* Get current thread's quantums */
int thread_get_num_waiting_for_sync(int sync_id);

#endif

